function Newmaowenke(tree,ea,iconPickerFa,colorpicker,autocomplete,treetable,laydate,form){
    this.tree = tree;
    this.ea = ea;
    this.iconPickerFa = iconPickerFa;
    this.colorpicker = colorpicker;
    this.autocomplete = autocomplete;
    this.treetable = treetable;
    this.laydate = laydate;
    this.form = form;
    var that = this;
    //解决树状多选框
    this.treemore = function (tree,ea){
        $(".demo-tree-more").each(function (i,v){
            console.log($(v))
            var url = $(v)[0].dataset.url;
            var show_id = $(v)[0].dataset.contentid;
            var name = $(v)[0].dataset.name
            var table = $(v)[0].dataset.table
            var relationship = $(v)[0].dataset.relationship
            var value = $(v)[0].dataset.value;
            if(value){
                value = JSON.parse(value);
            }
            // indexOf
            // console.log(value);
            function each(data){
                $.each(data,function (i,v){
                    if(!v.title){
                        v.title = v.name;
                    }
                    if(v.children){
                        v.children = each(v.children);
                    }
                    if(value instanceof Array){
                        if(value.indexOf(v[relationship])!==-1){
                            v.checked = true;
                        }
                    }
                    data[i] = v;
                })
                return data;
            }
            $.post(url,{table:table,name:name,relationship_primary_key:relationship,formtype:'treecheckbox'},function (res){
                var datas = res.data || [];
                datas = each(datas);
                console.log(datas)
                that.tree.render({
                    elem: '#'+show_id,
                    data: datas,
                    showCheckbox: true,
                    id: show_id+"ids",
                });
                that.ea.listen(function (data){
                    var checkedData = that.tree.getChecked(show_id+"ids");
                    var ids = [];
                    $.each(checkedData, function (i, v) {
                        ids.push(v.id);
                        if (v.children !== undefined && v.children.length > 0) {
                            $.each(v.children, function (ii, vv) {
                                ids.push(vv.id);
                            });
                        }
                    });
                    data[show_id] = JSON.stringify(ids);
                    return data;
                })
            })
        })
    }
    //解决ajax下拉框
    this.aselect = function (){
        $(".aselect").bind('input propertychange',function (data){
            var value = $(this).val();
            var url = data.target.dataset.url;
            var show_id = data.target.dataset.contentid;
            var name = data.target.dataset.name
            var table = data.target.dataset.table
            var relationship = data.target.dataset.relationship
            time = new Date().getTime();
            setTimeout(function (){
                var newtime = new Date().getTime();
                if(newtime>=time+499){
                    $.post(url,{table:table,value:value,name:name,relationship_primary_key:relationship,field:show_id,formtype:'aselect'},function (res){
                        // console.log(res);
                        var select_show = $("#"+show_id);
                        select_show.empty();
                        if(res.data.length>0){
                            var str = '<dd class="xuanzes" data-value="" class="">请选择</dd>';
                            $.each(res.data,function (i,v){
                                str +='<dd class="xuanzes" data-value="' + v[relationship] + '" class="">' + v[name] + '</dd>';
                            })
                            select_show.append(str)
                            select_show.show();
                        }else{
                            select_show.hide();
                        }
                    })
                    $('body').on('click','dd',function (data){
                        console.log(data);
                        var value = data.target.dataset.value;
                        var text = data.target.innerText;
                        // $(this).parent().prev().children('input')
                        // console.log($(this).parent().prev().children('input'))
                        $.each($(this).parent().prev().children('input'),function (i,v){
                            if(i==1){
                                $(v).val(value);
                            }else if(i==0){
                                $(v).val(text);
                            }
                        })
                        $(this).parent().hide();
                    })
                }else{
                    console.log('时间没到');
                }
            },500);
        })
    }
    //解决json
    this.AddJson = function (){
        $(document).on('click','[data-type=tianjia]',function (e){
            // console.log(e);
            var field = e.currentTarget.dataset.value;
            var html = "<div class=\"layui-row\">\n" +
                "                        <div class=\"layui-form-mid\">键：</div><input class=\"layui-input layui-input-inline\" style=\"width: 100px\" name=\""+field+"[key][]\" value=\"\">\n" +
                "                        <div class=\"layui-form-mid\">值：</div><input class=\"layui-input layui-input-inline\" style=\"width: 150px\" name=\""+field+"[value][]\" value=\"\">\n" +
                "                        <div class=\"layui-form-mid\"><input type=\"button\" data-type=\"jian\" class=\"layui-btn layui-btn-sm layui-btn-primary layui-border-red\" value=\"-\"></div>\n" +
                "                    </div>"
            $(this).parent().parent().append(html)
        })
        $(document).on('click','[data-type=jian]',function (e){
            console.log(e);
            $(this).parent().parent().remove();
        })
    }
    //解决icon
    this.AddIcon = function (){
        $(".icon").each(function (i,v) {
            var ids = $(v).attr('id');
            var myiconPickerFa = that.iconPickerFa.render({
                elem:"#"+ids,
                url: PATH_CONFIG.iconLess,
                limit: 12,
                click: function (data) {
                    $('#'+ids).val('fa ' + data.icon);
                },
                success: function (d) {
                    console.log(d);
                }
            })
        })
    }
    //解决color
    this.AddColor = function (){
        $(".color").each(function (i,v) {
            var ids = $(v).attr('id');
            var coles = $('[name='+ids+']').val();
            //初始色值
            var mycolorpicker = that.colorpicker.render({
                elem: '#'+ids
                ,color: coles //设置默认色
                ,change:function (color) {
                    $('[name='+ids+']').val(color);
                }
            });
        })
    }
    //解决datetime
    this.AddDateTime = function (){
        $(".datetime").each(function (i,v) {
            var ids = $(v).attr('id');
            that.laydate.render({
                elem: '#'+ids
                ,type: 'datetime'
            });
        })
    }
    //解决datetime
    this.AddDate = function (){
        $(".date").each(function (i,v) {
            var ids = $(v).attr('id');
            that.laydate.render({
                elem: '#'+ids
                ,type: 'date'
            });
        })
    }
    //解决time
    this.AddTime = function (){
        $(".time").each(function (i,v) {
            var ids = $(v).attr('id');
            that.laydate.render({
                elem: '#'+ids
                ,type: 'time'
            });
        })
    }
    this.AselectGroup = function (){
        that.form.on('input(ces)',function (data){
            console.log(data);
        })
    }
}